Internationalization is a process of enabling a program, e.g., Java, to run internationally. That is, an internationalized program has the flexibility to run correctly in any country. An internationalized program must be able to read, write and manipulate localized text. Furthermore, an internationalized program must conform to local customs when displaying dates and times, formatting numbers and sorting strings.
Internationalization is becoming increasingly important with the explosive growth of the Internet and the World Wide Web where an ever increasing number of computer users are from various locales. A locale represents a geographic, cultural or political region. One of the problems with internationalization involves the use of text strings that may be hard-coded in the program, e.g., Java. Hard-coded text strings refer to text that will not vary with the locale. That is, the text strings may appear in English even when the program is run on the French locale. Various object-oriented languages such as Java have developed tools to assist in developing internationalized programs and allowing text strings to appear in the language of the locale. A discussion of object-oriented programming languages and in particular Java is deemed appropriate.
In an object-oriented programming language such as Java, a class is a collection of data and methods that operate on that data. The data and methods taken together describe the state and behavior of what is commonly referred to as an object. An object in essence includes data and code where the code manipulates the data. Hence a software application may be written using an object-oriented programming language such as Java whereby the program's functionality is implemented using objects.
Unlike many programming languages, Java is compiled into machine independent code commonly referred to as bytecodes instead of machine dependent code, i.e. executable code. Bytecodes are stored in a particular file format commonly referred to as a “class file” that includes bytecodes for methods of a class. In addition to the bytecodes for methods of a class, the class file includes a symbol file as well as other ancillary information.
A computer program embodied as Java bytecodes in one or more class files is platform independent. The computer program may be executed, unmodified, on any computer that is able to run an implementation of what is commonly referred to as a Java virtual machine. The Java virtual machine is not an actual hardware platform, but rather a low level software emulator that can be implemented on many different computer processor architectures and under many different operating systems. The Java virtual machine reads and interprets each bytecode so that the instructions may be executed by the native processor. Hence a Java bytecode is capable of functioning on any platform that has a Java virtual machine implementation available. However, bytecode interpretation detracts from processor performance since the microprocessor has to spend some of its processing time interpreting bytecode instructions. Compilers commonly referred to as “just in time (JIT)” were developed to improve the performance of Java virtual machines. A JIT compiler translates Java bytecodes into the processor's native machine code during runtime. The processor then executes the compiled native machine code.
As stated above Java has developed tools to assist in developing internationalized programs and allowing text strings to appear in the language of the locale. One such tool is the use of resource files commonly referred to in Java as resource bundles. A resource bundle class may be used for externalizing text strings, i.e. messages. By externalizing text strings, appropriate text strings appear in the language of the locale. The resource bundle class is an associative array of keys and values. Keys are free formatted strings that appear in the program code as well as in the resource bundle thereby allowing the program to access the externalized string. Externalized strings may be represented as a value associated with the key. That is, appropriate text strings for a given locale are indexed by keys. Hence, the program may access an externalized string by accessing the value associated with the key in the resource bundle, i.e. the key that matches the key in the program code. By having resource bundles associated with particular locales, e.g., a resource file with resources associated with the US English locale, a resource file with resources associated with the French locale and so forth, appropriate text strings associated with the particular locale may be loaded at runtime.
Unfortunately, software developers may not define a key-value pair in the resource file, e.g., resource bundle, or mistype the key, i.e. free formatted string, in either the program code or the resource file source code thereby resulting in a resource exception error during the run-time of the application, e.g., Java. For example, a key-value pair in the resource file, e.g., resource bundle, may not be defined when there is no key or value associated with the key in the resource file, e.g., resource bundle. Furthermore, software developers may mistype the key, i.e. free formatted string, in either the program code or in the resource file source code so that the key, i.e. free formatted string, in the program code and in the resource file source code do not match and thereby prevent the program from accessing the externalized string in the resource file. When a procedure, commonly referred to as a method, in Java attempts to load an external string from the resource bundle and either the key-value pair is not defined in the resource file or the key in either the program code or resource file source code is mistyped, a resource exception error results. It would therefore be desirable to detect resource exception errors prior to the run-time of the application and subsequently define the key-value pair in the resource file, e.g., resource bundle, or correct the mistyped key in either the program code or resource file source code so as to avoid resource exception errors.